package com.feihong.txgw.tx_model;

import com.feihong.txgw.inter.contract.user.IUserInfoEditContract;
import com.feihong.txgw.utils.helper.RxHelper;
import com.feihong.txgw.utils.manage.RetrofitManager;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;

/**
 * @Author wangziheng`
 * @ProjectName txgw_app
 * @ClassName UserInfoEditMainModel
 * @package com.feihong.txgw.tx_model
 * @data 2018/5/7 20:17
 * @Describe
 * @Change
 */
public class UserInfoEditMainModel implements IUserInfoEditContract.IUserInfoEditMainModel {
    @Override
    public Observable getUserInfo(String type, String info) {
        Map<String,String> mParams = new HashMap<>();
        mParams.put("img_url",info);
        mParams.put("type",type);
        return RetrofitManager.getInstance().editUserNickName(mParams).compose(RxHelper.<String>rxSchedulerHelper());
    }

    @Override
    public Observable upLoadUserImg(MultipartBody.Part file) {
        return RetrofitManager.getInstance().upLoadUserImg(file).compose(RxHelper.<String>rxSchedulerHelper());
    }

    public static UserInfoEditMainModel create(){
        return new UserInfoEditMainModel();
    }
}
